package com.tarena.vehicle.management.converter;

import com.tarena.vehicle.management.pojo.entity.VehicleInspection;
import com.tarena.vehicle.management.pojo.param.VehicleInspectionAddNewParam;
import com.tarena.vehicle.management.pojo.param.VehicleInspectionUpdateParam;
import com.tarena.vehicle.management.pojo.query.VehicleInspectionQuery;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;

@Component
public class VehicleInspectionConverter {

    public VehicleInspection param2po(VehicleInspectionAddNewParam param) {
        VehicleInspection vehicleInspection = new VehicleInspection();
        BeanUtils.copyProperties(param,vehicleInspection);
        vehicleInspection=setUserMessage(vehicleInspection);
        return vehicleInspection;
    }

    public VehicleInspection param2po(VehicleInspectionUpdateParam param) {
        VehicleInspection vehicleInspection = new VehicleInspection();
        BeanUtils.copyProperties(param,vehicleInspection);
        vehicleInspection=setUserMessage(vehicleInspection);
        return vehicleInspection;
    }

    public VehicleInspection query2po(VehicleInspectionQuery query) {
        VehicleInspection vehicleInspection = new VehicleInspection();
        BeanUtils.copyProperties(query,vehicleInspection);
        return vehicleInspection;
    }
    public VehicleInspection setUserMessage(VehicleInspection vehicleInspection){
        vehicleInspection.setUid(1);
        vehicleInspection.setOrgid(1);
        vehicleInspection.setCompanyCode("JSDTN2210");
        return vehicleInspection;
    }


}
